//
//  KDDCollectionView.m
//  MengLiao
//
//  Created by xiuxin on 2022/7/15.
//  Copyright © 2022 HZMengLiao. All rights reserved.
//

#import "KDDCollectionView.h"

@implementation KDDCollectionView
@dynamic displayInsets;
@dynamic collectionViewLayout;

- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout
{
    if (layout == nil || ![layout isKindOfClass:[KDDCollectionLayout class]])
    {
        layout = [KDDCollectionLayout new];
    }
    if (self = [super initWithFrame:frame collectionViewLayout:layout])
    {
        self.alwaysBounceVertical = YES;
        self.directionalLockEnabled = YES;
        self.showsHorizontalScrollIndicator = NO;
        if (@available(iOS 11.0, *)) {
            self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
        }
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

- (UIEdgeInsets)displayInsets
{
    return self.collectionViewLayout.displayInsets;
}

- (void)setDisplayInsets:(UIEdgeInsets)displayInsets
{
    self.collectionViewLayout.displayInsets = displayInsets;
}

@end
